package com.guoxin.chapter3.waitnotify.waitnotifysize5;

/**
 * @author guoxin
 * @date 2019年8月22日
 */
public class ThreadB extends Thread{
	private volatile MyList list;

	public ThreadB(MyList list) {
		super();
		this.list = list;
	}
	
	@Override
	public void run() {
		try {
			synchronized (list) {
				if(list.size()!=5){
					System.out.println("wait begin "+System.currentTimeMillis());
					list.wait();
					System.out.println("wait end "+System.currentTimeMillis());
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
}
